package com.research.performace.entities;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "tblcustomer")
public class Customer {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "ID")
	private Long id;
	
	@Column(name = "FullName")
	private String fullName = "";
	
	@Column(name = "Email")
	private String email = "";
	
	@Column(name = "Address")
	private String address = "";
	
	@Column(name = "Tell")
	private String tell;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CountryID")
	private Country country;
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "customer")
	private List<Invoice> invoices;

	/**
	 * Constructor
	 */
	public Customer() { }

	/**
	 * Constructor
	 * @param fullName
	 * @param email
	 * @param address
	 * @param tell
	 */
	public Customer(String fullName, String email, String address, String tell) {
		this.fullName = fullName;
		this.email = email;
		this.address = address;
		this.tell = tell;
	}
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getFullName() {
		return fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getTell() {
		return tell;
	}

	public void setTell(String tell) {
		this.tell = tell;
	}

	public Country getCountry() {
		return country;
	}

	public void setCountry(Country country) {
		this.country = country;
	}

	public List<Invoice> getInvoices() {
		return invoices;
	}

	public void setInvoices(List<Invoice> invoices) {
		this.invoices = invoices;
	}
	
}
